/*
 * PipesGameMidlet.java
 *
 * Created on 31 juli 2006, 0:42
 */

package be.drapier;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

/**
 *
 * @author  Wim Drapier
 * @version
 */
public class PipesGameMidlet extends MIDlet implements CommandListener {
    
    private static final Command EXIT_COMMAND = new Command("Exit", Command.EXIT, 0);
    
    private Display d;
    private PipesCanvas c;
    
    public PipesGameMidlet() {
        d = Display.getDisplay(this);
        c = new PipesCanvas();
        c.addCommand(EXIT_COMMAND);
        c.setCommandListener(this);
        
    }
    public void startApp() {
        
        d.setCurrent(c);
    }
    
    public void pauseApp() {
    }
    
    public void destroyApp(boolean unconditional) {
        d.setCurrent((Displayable)null);
        c.hideNotify();
    }

    public void commandAction(Command command, Displayable displayable) {
        if (command.getCommandType( ) == Command.EXIT) {
            destroyApp(false);
            notifyDestroyed();
        }
    }
}
